<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/table_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:01 GMT -->
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">



    <link rel="shortcut icon" href="favicon.ico"> <link href="__PUBLIC__/dist/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/style.min862f.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>文章列表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-9 m-b-xs">
                            <a href="{:Url('Article/info')}" class="btn btn-primary">增加</a>
                        </div>

                        <div class="col-sm-3">
                            <form method="get">
                                <div class="input-group">
                                    <input type="text" placeholder="请输入文章标题关键词" name="keyword" value="{:input('param.keyword')}" class="form-control">
                                    <span class="input-group-btn">
                                        <button type="submit" class="btn btn-primary"> 搜索</button>
                                    </span>
                                </div>
                            </form>
                        </div>
                    </div>
                    <form method="post" action="{:Url('Article/changeSort')}">
                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th>排序</th>
                                <th>文章标题</th>
                                <th>文章分类</th>
                                <th>是否显示</th>
                                <th>添加时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {foreach name="list" item="item"}
                                <tr>
                                    <td>
                                        <input type="hidden" name="article_id[]" value="{$item.id}">
                                        <input type="text" name="sort[]" class="form-control" style="width:60px;text-align:center" value="{$item.sort}">
                                    </td>
                                    <td>{$item.title}</td>
                                    <td>{$item.cate_name}</td>
                                    <td>
                                        {if condition="$item['is_show'] eq 1"}
                                            <a href="javascript:;" data-id="{$item.id}" class="toggleSale fa fa-check-circle text-info" style="font-size: 3rem;"></a>
                                            {else/}
                                            <a href="javascript:;" data-id="{$item.id}" class="toggleSale fa fa-times-circle text-danger" style="font-size: 3rem;"></a>
                                        {/if}
                                    </td>
                                    <td>{$item['addtime']|date="Y-m-d H:i:s",###}</td>
                                    <td>
                                        <a href="#" class="btn btn-success btn-xs" target="_blank">查看</a>
                                        <a href="{:Url('Article/info',['id'=>$item['id']])}" class="btn btn-warning btn-xs">编辑</a>
                                        <a href="{:Url('Article/delete',['id'=>$item['id']])}" class="btn btn-danger btn-xs" onclick="return confirm('确认删除？');">删除</a>
                                    </td>
                                </tr>
                            {/foreach}
                            </tbody>
                        </table>
                        <button type="submit" class="btn btn-warning">更新排序</button>
                    </form>

                    <div class="row">
                        <div class="col-sm-12 text-center">
                            {$page}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__PUBLIC__/dist/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/dist/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/dist/js/plugins/peity/jquery.peity.min.js"></script>
<script src="__PUBLIC__/dist/js/content.min.js?v=1.0.0"></script>
<script src="__PUBLIC__/dist/js/plugins/iCheck/icheck.min.js"></script>
<script src="__PUBLIC__/dist/js/demo/peity-demo.min.js"></script>
<script src="__PUBLIC__/dist/js/plugins/layer/layer.min.js"></script>
<script>
    $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
    $('.toggleSale').click(function(){
        var obj = $(this);
        var id = obj.data('id');
        var show = obj.hasClass('fa-check-circle') ? 2 : 1; //sale:1切换到显示，2切换到隐藏
        $.ajax({
            url:"{:Url('Article/toggleShow')}",
            type:'post',
            data:{id:id,is_show:show},
            success:function(res){
                if(res > 0){
                    if(show == 1){
                        obj.attr('class','toggleSale fa fa-check-circle text-info');
                    }else if(show == 2){
                        obj.attr('class','toggleSale fa fa-times-circle text-danger');
                    }
                    layer.msg('操作成功');
                }else{
                    layer.msg('操作失败');
                }
            }
        })
    });

</script>

</body>


<!-- Mirrored from www.zi-han.net/theme/hplus/table_basic.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:01 GMT -->
</html>
